//
//  NewMainViewController.m
//  Doctor1.0
//
//  Created by mk on 15/11/2.
//  Copyright (c) 2015年 cocoa-mk. All rights reserved.
//

#import "NewMainViewController.h"
#import "UserMainViewController.h"
#import "CreatePatientMainViewController.h"


@interface NewMainViewController ()
{
    IBOutlet UIImageView * imageTopbg;
    IBOutlet UIButton * btnCreate;
    IBOutlet UIButton * btnUser;
}

@end

@implementation NewMainViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    viewNavBg.hidden = YES;
    btnBack.hidden = YES;
    
    for (NSLayoutConstraint *constraints in [btnCreate constraints])
    {
        if (constraints.firstItem == btnCreate && constraints.firstAttribute == NSLayoutAttributeHeight)
        {
            constraints.constant = (btnCreate.width/1.5);
            break;
        }
    }

    
    btnCreate.layer.cornerRadius = 8;
    btnUser.layer.cornerRadius = 8;
    [btnCreate setBackgroundImage:[[UIImage imageNamed:@"main_crerate_user_btn.png"] stretchableImageWithLeftCapWidth:20 topCapHeight:20] forState:UIControlStateNormal];
    [btnCreate setBackgroundImage:[[UIImage imageNamed:@"main_crerate_user_btn_down.png"] stretchableImageWithLeftCapWidth:20 topCapHeight:20] forState:UIControlStateHighlighted];
    [btnUser setBackgroundImage:[[UIImage imageNamed:@"main_user_center_btn.png"] stretchableImageWithLeftCapWidth:20 topCapHeight:20] forState:UIControlStateNormal];
    [btnUser setBackgroundImage:[[UIImage imageNamed:@"main_user_center_btn_down.png"] stretchableImageWithLeftCapWidth:20 topCapHeight:20] forState:UIControlStateHighlighted];
    
}


-(IBAction)btnCreatePatient:(id)sender
{
    if (![gProjConfig needLogin])
    {
        CreatePatientMainViewController * patien = [[CreatePatientMainViewController alloc]initWithNibName:@"CreatePatientMainViewController" bundle:nil];
        [self.navigationController pushViewController:patien animated:YES];
    }
}


-(IBAction)btnUserCenter:(id)sender
{
    UserMainViewController * main = [[UserMainViewController alloc]initWithNibName:@"UserMainViewController" bundle:nil];
    [self.navigationController pushViewController:main animated:YES];

}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end









